<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>JS代码的执行顺序</title>
</head>
<body onload="ready()">
    <script type="text/javascript">
        function ready() {
            var btn = document.getElementById("btn");
            btn.onclick = function () {
                alert("hello js !")
            }
        }
    </script>

    <input type="button" value="hello" id="btn"/>



</body>
</html>